package sbc.group1.lab1.mozartspaces;

import java.util.LinkedHashMap;

public class Cache<K,V> extends LinkedHashMap<K, V>{
    
    private static final float DEFAULT_LOAD_FACTOR = 0.75f;
    private final int cacheSize;
    
    public Cache(int size) {
        super(size,DEFAULT_LOAD_FACTOR,true);
        this.cacheSize=size;
    }
    
    @Override
    protected boolean removeEldestEntry(java.util.Map.Entry<K, V> eldest) {
        return size() > cacheSize;
    }
}
